﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Reporting.WebForms;
using STT.Business;
using STT.Entities;
using STT.Layer.Connection;
using System.Data;
namespace STT.Admin.UserControls
{
    public partial class ucThongKeGiangVien : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Methods.DonViGiangVien(ref ddDonVi, Session["TenDN"].ToString());
        }

        void LoadData()
        {
            if (ddGiangDay.SelectedValue.ToString() == "1")
            {
                DataTable dt = BTbGiangVien.StatisticsTeacherDaDay(new ETbGiangVien
                {
                    MaDonVi = int.Parse(ddDonVi.SelectedValue.ToString())
                }, Session["TenDN"].ToString());
                rpvGiangVien.Visible = true;
                rpvGiangVien.LocalReport.ReportPath = "RDLC\\TKeGiangVien.rdlc";
                rpvGiangVien.LocalReport.DataSources.Clear();
                rpvGiangVien.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt));
            }
            else
            {
                DataTable dt = BTbGiangVien.StatisticsTeacherChuaDay(new ETbGiangVien
                {
                    MaDonVi = int.Parse(ddDonVi.SelectedValue.ToString())
                }, Session["TenDN"].ToString());
                rpvGiangVien.Visible = true;
                rpvGiangVien.LocalReport.ReportPath = "RDLC\\TKeGiangVien.rdlc";
                rpvGiangVien.LocalReport.DataSources.Clear();
                rpvGiangVien.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt));
            }

        }

        protected void btTimKiem_Click(object sender, EventArgs e)
        {
            LoadData();
        }

    }
}